package cn.itlaobing.springbootdemo.entity;

import org.springframework.data.jpa.domain.AbstractPersistable;

import javax.persistence.*;

@Entity
@Table(name="system_accounts")
public class SystemAccount  extends AbstractPersistable<Long> {

    @Column(length = 30,nullable = false,unique = true)
    private String account; //账号必须唯一
    @Column(length = 64,nullable = false)
    private String passwordDigest;
    @Column(length = 32,nullable = false)
    private String salt;  //盐值

    //头像 系统将图片存储到七牛云，会得到一个图片的URL，这个URL存储到这个字段上。
    private String picHead;

    @OneToOne
    @JoinColumn(name = "student_id",unique = true)
    private Student student;

    public String getPicHead() {
        return picHead;
    }

    public void setPicHead(String picHead) {
        this.picHead = picHead;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPasswordDigest() {
        return passwordDigest;
    }

    public void setPasswordDigest(String passwordDigest) {
        this.passwordDigest = passwordDigest;
    }
}
